# 构建数据
var haystack = "hello";
var needle = "ll";

# 定义函数
function strStr(haystack, needle) {
    var left = 0;
    var right = needle.length();
    for (right < haystack.length()){
        if (needle == (haystack.substring(left,right))) return left;
        left=left+1;
        right=right+1;
    }
    return -1;
}

# 输出结果
print(strStr(haystack,needle));